Home

Operator Usage

Name

pick-elt

Description

pick-elt input-sp
randomly pick a ket from the input superposition
the probability of being picked is uniform, independent of the coefficient
the returned ket has the same coefficient as in the input superposiiton
for weighted probabilities, use weighted-pick-elt


Examples


-- if applied to an empty ket, return the empty ket:
pick-elt |>
    |>

-- applied to a clean superposition:
pick-elt split |uvwxyz>
    |x>

-- applied to a random superposition:
pick-elt random[1, 0.7] (|1> .. |10>)
    1.108204|4>


See also

Operator type

core normal